<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf"><?= $goods_id . '---' . $title ?></div>
                </div>
                <div class="widget-body am-fr">
                    <div class="order-list am-scrollable-horizontal am-u-sm-12 am-margin-top-xs">
                        <?
                        var_dump($list);
                        ?>
                        <table width="100%" class="am-table am-table-centered
                        am-text-nowrap am-margin-bottom-xs">
                            <thead>
                                <tr>
                                    <th width="30%" class="goods-detail">商品信息</th>
                                    <th width="10%">单价/数量</th>
                                    <th width="15%">实付款</th>
                                    <th>买家</th>
                                    <th>交易状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php if (!$list->isEmpty()) : foreach ($list as $index => $order) : ?>
                                        <tr class="order-empty">
                                            <td colspan="6"></td>
                                        </tr>
                                        <tr>
                                            <td class="am-text-middle am-text-left" colspan="6">
                                                <span class="am-margin-right-lg"> <strong>序号：<?= $index + 1 ?></strong></span>
                                                <span class="am-margin-right-lg"> <?= $order['create_time'] ?></span>
                                                <span class="am-margin-right-lg">订单号：<?= $order['order_no'] ?></span>
                                                <span class="am-margin-right-lg">微信支付号：<?= $order['transaction_id'] ?></span>
                                            </td>
                                        </tr>
                                        <?php $i = 0;
                                        foreach ($order['goods'] as $goods) : $i++; ?>
                                            <tr>
                                                <td class="goods-detail am-text-middle">
                                                    <div class="goods-info">
                                                        <p class="goods-title"><?= $goods['goods_name'] ?></p>
                                                        <p class="goods-spec am-link-muted">
                                                            <?= $goods['goods_attr'] ?>
                                                        </p>
                                                    </div>
                                                </td>
                                                <td class="am-text-middle">
                                                    <p>￥<?= $goods['goods_price'] ?></p>
                                                    <p>×<?= $goods['total_num'] ?></p>
                                                </td>
                                                <?php if ($i === 1) : $goodsCount = count($order['goods']); ?>
                                                    <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                        <p>￥<?= $order['pay_price'] ?></p>

                                                    </td>
                                                    <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                        <p><?= $order['user']['nickName'] ?></p>
                                                        <p class="am-link-muted">(姓名：<?= $order['address']['name'] ?>)</p>
                                                        <p class="am-link-muted">(学校:<?= $order['address']['detail'] ?>)</p>
                                                        <p class="am-link-muted">
                                                            (电话:<?= substr($order['address']['phone'], 0, 3) ?>****<?= substr($order['address']['phone'], 6, 4) ?>)
                                                        </p>
                                                        <!-- <p class="am-link-muted">(用户id：<?= $order['user']['user_id'] ?>)</p> -->
                                                    </td>
                                                    <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                        <p>订单状态： <?= $order['order_status']['text'] ?></span> </p>
                                                        <p>付款状态：
                                                            <span class="am-badge
                                                <?= $order['pay_status']['value'] == 20 ? 'am-badge-success' : '' ?>
                                                <?= $order['pay_status']['value'] == 30 ? 'am-badge-danger' : '' ?>
                                                ">
                                                                <?= $order['pay_status']['text'] ?></span>
                                                        </p>
                                                        <p>发货状态：
                                                            <span class="am-badge
                                                <?= $order['delivery_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
                                                                <?= $order['delivery_status']['text'] ?></span>
                                                        </p>
                                                        <p>收货状态：
                                                            <span class="am-badge
                                                <?= $order['receipt_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
                                                                <?= $order['receipt_status']['text'] ?></span>
                                                        </p>
                                                    </td>
                                                    <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                        <div class="tpl-table-black-operation">
                                                            <a class="tpl-table-black-operation-green" href="<?= url('order/detail', ['order_id' => $order['order_id']]) ?>">
                                                                订单详情</a>
                                                            <?php if (
                                                                $order['pay_status']['value'] == 20
                                                                && $order['delivery_status']['value'] == 10
                                                            ) : ?>
                                                                <a class="tpl-table-black-operation" href="<?= url(
                                                                                                                'order/detail#delivery',
                                                                                                                ['order_id' => $order['order_id']]
                                                                                                            ) ?>">
                                                                    编辑订单</a>
                                                            <?php endif; ?>
                                                        </div>
                                                    </td>
                                                <?php endif; ?>
                                            </tr>
                                        <?php endforeach; ?>
                                    <?php endforeach;
                                else : ?>
                                    <tr>
                                        <td colspan="6" class="am-text-center">暂无记录</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>